using System;
using System.Threading.Tasks;
using HengTong.Model.Db.Ai;
using WalkingTec.Mvvm.Core;
using UUIDNext;


namespace HengTong.ViewModel._Admin.SysPromptGroupVms
{
    public partial class SysPromptGroupVm : CrudVm<SysPromptGroup>
    {

        public SysPromptGroupVm()
        {
        }

        protected override void InitVM()
        {
        }

        public override async Task DoAddAsync()
        {
            if (Entity is IBasePoco poco)
            {
                poco.CreateBy = Wtm.LoginUserInfo?.ITCode;
                poco.UpdateBy = Wtm.LoginUserInfo?.ITCode;
                poco.CreateTime = DateTime.Now;
                poco.UpdateTime = DateTime.Now;
            }
            Entity.ID = Uuid.NewDatabaseFriendly(Database.SqlServer);
            await base.DoAddAsync();
        }

        public override async Task DoEditAsync(bool updateAllFields = false)
        {
            if (Entity is IBasePoco poco)
            {
                poco.UpdateBy = Wtm.LoginUserInfo?.ITCode;
                poco.UpdateTime = DateTime.Now;
            }
            await base.DoEditAsync(updateAllFields);
        }

    }
}
